#include <ustdio.h>
#include <uprocess.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "rc.h"
uint32_t buf = 0;

int driverrc_cb(char *path){
	uexec(path);
	return 1;
}

int main(int argc,char **argv){
	printf("\nINIT V0.0.2 running.\n");
	printf("Mounting devfs on /dev...");
	if (!u_mount("/dev","/dev","devfs")){
		printf("FAILED (0x%x)\n",errno);
		return 0;
	}
	printf("OK\n");
	printf("Loading drivers...\n");
	if (exec_rc("/etc/drivers.rc",driverrc_cb) != 0)
		printf("INIT ERROR: Failed to load all drivers!\n");
	printf("Catting input:\n");
	while(1){
		uint8_t buf = 0;
		uread(0,&buf,1);
		uwrite(1,&buf,1);
	}
}